this._chrome = new Chrome(this);
+ this.screenShieldGroup = new St.Widget({ name: 'screenShieldGroup',
+ visible: false,
+ clip_to_allocation: true,
+ });
+ this.addChrome(this.screenShieldGroup);
+
this.panelBox = new St.BoxLayout({ name: 'panelBox',
vertical: true });
this.addChrome(this.panelBox, { affectsStruts: true,
this.panelBox.connect('allocation-changed',
Lang.bind(this, this._updatePanelBarriers));
- this.screenShieldGroup = new St.Widget({ name: 'screenShieldGroup',
- visible: false,
- clip_to_allocation: true,
- });
- this.addChrome(this.screenShieldGroup);
-
this.trayBox = new St.BoxLayout({ name: 'trayBox' });
this.addChrome(this.trayBox);
this.trayBox.connect('allocation-changed',
this._sync();
},
+ setLockedState: function(locked) {
+ if (locked)
+ this.hide();
+ else
+ this._sync();
+ },
+
_sync: function() {
let tracker = Shell.WindowTracker.get_default();
let focusedApp = tracker.focus_app;
this.actor.remove_style_class_name('in-overview');
}));
+ Main.screenShield.connect('lock-status-changed', Lang.bind(this, this._onLockStateChanged));
+
this._menus = new PopupMenu.PopupMenuManager(this);
this._leftBox = new St.BoxLayout({ name: 'panelLeft' });
this._statusArea[role] = indicator;
let destroyId = indicator.connect('destroy', Lang.bind(this, function(emitter) {
- this._statusArea[role] = null;
+ delete this._statusArea[role];
emitter.disconnect(destroyId);
}));
if (box && box._delegate instanceof PanelMenu.ButtonBox)
box.destroy();
},
+
+ _onLockStateChanged: function(shield, locked) {
+ if (this._activitiesButton)
+ this._activitiesButton.setLockedState(locked);
+ if (this._appMenu)
+ this._appMenu.setLockedState(locked);
+ if (this._dateMenu)
+ this._dateMenu.setLockedState(locked);
+
+ for (let id in this._statusArea)
+ this._statusArea[id].setLockedState(locked);
+ },
});
}
},
+ setLockedState: function(locked) {
+ // default behaviour is to hide completely
+ if (locked)
+ this.menu.close();
+ this.actor.visible = !locked;
+ },
+
_onButtonPress: function(actor, event) {
if (!this.menu)
return;
this._activeMenuItem = null;
this._childMenus = [];
+ this._settingsActions = { };
},
addAction: function(title, callback) {
Main.overview.hide();
app.activate();
});
+
+ this._settingsActions[desktopFile] = menuItem;
+
return menuItem;
},
+ setSettingsVisibility: function(visible) {
+ for (let id in this._settingsActions) {
+ let item = this._settingsActions[id];
+ item.actor.visible = visible;
+ }
+ },
+
isEmpty: function() {
return this.box.get_n_children() == 0;
},
this.menu.addSettingsAction(_("Universal Access Settings"), 'gnome-universal-access-panel.desktop');
},
+ setLockedState: function(locked) {
+ this.menu.setSettingsVisibility(!locked);
+ },
+
_buildItemExtended: function(string, initial_value, writable, on_set) {
let widget = new PopupMenu.PopupSwitchMenuItem(string, initial_value);
if (!writable)
this._applet.connect('cancel-request', Lang.bind(this, this._cancelRequest));
},
+ setLockedState: function(locked) {
+ this._isLocked = locked;
+ this._updateKillswitch();
+ },
+
_updateKillswitch: function() {
let current_state = this._applet.killswitch_state;
let on = current_state == GnomeBluetoothApplet.KillswitchState.UNBLOCKED;
/* TRANSLATORS: this means that bluetooth was disabled by hardware rfkill */
this._killswitch.setStatus(_("hardware disabled"));
- this.actor.visible = has_adapter;
+ this.actor.visible = !this._isLocked && has_adapter;
if (on) {
this._discoverable.actor.show();
// option if need arises.
if (Main.sessionMode.allowSettings) {
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
- this.menu.addAction(_("Show Keyboard Layout"), Lang.bind(this, this._showLayout));
+ this._showLayoutItem = this.menu.addAction(_("Show Keyboard Layout"), Lang.bind(this, this._showLayout));
}
this.menu.addSettingsAction(_("Region and Language Settings"), 'gnome-region-panel.desktop');
},
+ setLockedState: function(locked) {
+ this._showLayoutItem.actor.visible = !locked;
+ this.menu.setSettingsVisibility(!locked);
+ },
+
_currentInputSourceChanged: function() {
let nVisibleSources = Object.keys(this._layoutItems).length;
if (nVisibleSources < 2)
this._primaryIcon.icon_name = iconName;
},
+ setLockedState: function(locked) {
+ // FIXME: more design discussion is needed before we can
+ // expose part of this menu
+
+ if (locked)
+ this.menu.close();
+ this.actor.reactive = !locked;
+ },
+
_ensureSource: function() {
if (!this._source) {
this._source = new MessageTray.Source(_("Network Manager"),
this._devicesChanged();
},
+ setLockedState: function(locked) {
+ if (locked)
+ this.menu.close();
+ this.actor.reactive = !locked;
+ },
+
_readPrimaryDevice: function() {
this._proxy.GetPrimaryDeviceRemote(Lang.bind(this, function(result, error) {
if (error) {
this._control.open();
},
+ setLockedState: function(locked) {
+ this.menu.setSettingsVisibility(!locked);
+ },
+
_onScrollEvent: function(actor, event) {
let direction = event.get_scroll_direction();
let currentVolume = this._output.volume;
this._upClient.connect('notify::can-suspend', Lang.bind(this, this._updateSuspendOrPowerOff));
},
+ setLockedState: function(locked) {
+ if (locked)
+ this.menu.close();
+ this.actor.reactive = !locked;
+ },
+
_onDestroy: function() {
this._user.disconnect(this._userLoadedId);
this._user.disconnect(this._userChangedId);